package com.liner.collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class NewForDemo {
    public static void main(String[] args) {

        String[] array = {"one", "two", "three", "four", "five"};

        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i] + "\t");
        }

        for (String s : array) {
            System.out.print(s + "\t");
        }

        Collection<Object> collection = new ArrayList<>();
        collection.add("one");
        collection.add("two");
        collection.add("three");
        collection.add("four");
        collection.add("five");
        Iterator<Object> iterator = collection.iterator();

        while (iterator.hasNext()){
            String next = (String) iterator.next();
            System.out.println(next);
        }



        for (Object o : collection) {
            System.out.print(o + "\t");
        }

        System.out.println(collection);



    }
}
